﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link type="text/css" rel="stylesheet" media="all" href="styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="styles/global_color.css"/>
    <script src="js/jquery-2.2.4.min.js"></script>


</head>
<body class="index">
<div class="login_box">
    <table>
        <tr>
            <td class="login_info">账号：</td>
            <td colspan="2"><input id="in1" name="username" type="text" class="width150"/></td>
            <td class="login_error_info"><span id="sp1" class="required">30长度的字母、数字和下划线</span></td>
        </tr>
        <tr>
            <td class="login_info">密码：</td>
            <td colspan="2"><input id="in2" name="password" type="password" class="width150"/></td>
            <td><span id="sp2" class="required">30长度的字母、数字和下划线</span></td>
        </tr>
        <tr>
            <td class="login_info">验证码：</td>
            <td class="width70"><input id="in3" name="code" type="text" class="width70"/></td>
            <td><img src="/kobe/getCode" alt="验证码" title="点击更换"
                     onclick="this.src='/kobe/getCode?d='+Math.random();"/></td>
            <td><span id="sp3" class="required">验证码错误</span></td>
        </tr>
        <tr>
            <td></td>
            <td class="login_button" colspan="2">
                <!--<a type="button" onclick="window.location.href='/kobe/index.html'"><img src="images/login_btn.png"/></a>-->
                <a type="button"><img src="images/login_btn.png"/></a>
            </td>
            <td><span class="required">用户名或密码错误，请重试</span></td>


        </tr>
    </table>
</div>


<script>
    <!--提示span区域的显示隐藏-->
    $(function () {
        $('#in1').blur(function () {
            var r1 = /[a-zA-Z0-9]{5}/;
            var value = $("#in1").val();
            if (!r1.test(value)) {
                $('#sp1').show();
            }
            if (r1.test(value)) {
                $('#sp1').hide();
            }
        });
        $('#in2').blur(function () {
            var r1 = /[a-zA-Z0-9]{5}/;
            var value = $("#in2").val();
            if (!r1.test(value)) {
                $('#sp2').show();
            }
            if (r1.test(value)) {
                $('#sp2').hide();
            }
        });
        $('#in3').blur(function () {
            var r1 = /[a-zA-Z0-9]{5}/;
            var value = $("#in3").val();
            if (!r1.test(value)) {
                $('#sp3').show();
            }
            if (r1.test(value)) {
                $('#sp3').hide();
            }
        });
        //  登录点击事件


        $("a").click(function (e) {
            var name = $("#in1").val();
            var password = $("#in2").val();
            var code = $("#in3").val();
            console.log(code);
            e.preventDefault();
            var url = "/kobe/admin/findOne1";
            var data = {
                "name": name,
                "password": password,
                "code": code
            };
            $.get(url, data, function (resp) {
                console.log(resp);
                if (resp==true) {
                    window.location.href="/kobe/index.html";
                }else {
                    window.location.href="/kobe/login.html";
                }
            })

        });
    });
</script>
</body>
</html>
